/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package patternmining.model.construction.bpsl;

import patternmining.model.graph.Graph;
import patternmining.model.graph.bpsl.*;

/**
 *
 * @author Holger
 */
public class BpslFakeSource extends BpslSource{

    public void buildGraph() {
        // construct the BPSLGraph of the formula of the Observe Pattern
        graph = new BpslFormula();
        //add the vertices representing the formula variables
        BpslVariable observer = new BpslClass("Observer");
        graph.add(observer);
        BpslVariable concreteObserver = new BpslClass("ConcreteObserver");
        graph.add(concreteObserver);
        BpslVariable subject = new BpslClass("Subject");
        graph.add(subject);
        BpslVariable concreteSubject = new BpslClass("ConcreteSubject");
        graph.add(concreteSubject);
        BpslVariable attach = new BpslMethod("attach");
        graph.add(attach);
        BpslVariable detach = new BpslMethod("detach");
        graph.add(detach);
        BpslVariable notify = new BpslMethod("notify");
        graph.add(notify);
        BpslVariable get_state = new BpslMethod("get-state");
        graph.add(get_state);
        BpslVariable set_state = new BpslMethod("set-state");
        graph.add(set_state);
        BpslVariable update = new BpslMethod("update");
        graph.add(update);
        BpslVariable subject_state = new BpslTypedVariable("subject-state");
        graph.add(subject_state);
        BpslVariable observer_state = new BpslTypedVariable("observer-state");
        graph.add(observer_state);
        //add the edges representing the predicates of the formula
        BpslPredicate defined_InSubjectState = new BpslDefined_In(subject_state, concreteSubject);
        graph.add(defined_InSubjectState);
        BpslPredicate defined_InObserverState = new BpslDefined_In(observer_state, concreteObserver);
        graph.add(defined_InObserverState);
        BpslPredicate defined_InAttach = new BpslDefined_In(attach, subject);
        graph.add(defined_InAttach);
        BpslPredicate defined_InDetach = new BpslDefined_In(detach, subject);
        graph.add(defined_InDetach);
        BpslPredicate defined_InNotify = new BpslDefined_In(notify, subject);
        graph.add(defined_InNotify);
        BpslPredicate defined_InSetState = new BpslDefined_In(set_state, concreteSubject);
        graph.add(defined_InSetState);
        BpslPredicate defined_InGetState = new BpslDefined_In(get_state, concreteSubject);
        graph.add(defined_InGetState);
        BpslPredicate defined_InUpdate = new BpslDefined_In(update, observer);
        graph.add(defined_InUpdate);
        BpslPredicate referenceToOne = new BpslReference_to_One(concreteObserver, concreteSubject);
        graph.add(referenceToOne);
        BpslPredicate referenceToMany = new BpslReference_to_Many(subject, observer);
        graph.add(referenceToMany);
        BpslPredicate inheritanceObserver = new BpslInheritance(concreteObserver, observer);
        graph.add(inheritanceObserver);
        BpslPredicate inheritanceSubject = new BpslInheritance(concreteSubject, subject);
        graph.add(inheritanceSubject);
        BpslPredicate invocationSetState = new BpslInvocation(set_state, notify);
        graph.add(invocationSetState);
        BpslPredicate invocationNotify = new BpslInvocation(notify, update);
        graph.add(invocationNotify);
        BpslPredicate invocationUpdate = new BpslInvocation(update, get_state);
        graph.add(invocationUpdate);
        BpslPredicate argumentAttach = new BpslArgument(observer, attach);
        graph.add(argumentAttach);
        BpslPredicate argumentDetach = new BpslArgument(observer, detach);
        graph.add(argumentDetach);
        BpslPredicate argumentUpdate = new BpslArgument(subject, update);
        graph.add(argumentUpdate);
    }

    public Graph getGraph() {
        return graph;
    }

    public void includeFile() {
         // do nothing, since no file will be parsed for the construction of the fake graph
    }

}
